1. Field of the Invention
The present invention relates to data structures, and, more particularly, to a method of referencing a data structure and transferring data between two different data structures.
2. Description of the Related Art
An operating system is an organized collection of programs and data that is specifically designed to manage the resources of computer system and to facilitate the creation of computer programs and control their execution on that system. The use of an operating system obviates the need to provide individual and unique access to the hardware of a computer for each user wishing to run a program on that computer. This simplifies the user""s task of writing of a program because the user is relieved of having to write routines to interface the program to the computer""s hardware. Instead, the user accesses such functionality using standard system calls, which are generally referred to in the aggregate as an application programming interface (API).
A current trend in the design of operating systems is toward smaller operating systems. In particular, operating systems known as microkernels are becoming increasingly prevalent. In certain microkernel operating system architectures, some of the functions normally associated with the operating system, accessed via calls to the operating system""s API, are moved into the user space and executed as user tasks. Microkernels thus tend to be faster and simpler than more complex operating systems.
These advantages are of particular benefit in specialized applications that do not require the range of functionalities provided by a standard operating system. For example, a microkernel-based system is particularly well suited to embedded applications. Embedded applications include information appliances (personal digital assistance (PDAs), network computers, cellular phones, and other such devices), household appliances (e.g., televisions, electronic games, kitchen appliances, and the like), and other such applications. The modularity provided by a microkernel allows only the necessary functions (modules) to be used. Thus, the code required to operate such a device can be kept to a minimum by starting with the microkernel and adding only those modules required for the device""s operation. The simplicity afforded by the use of a microkernel also makes programming such devices simpler.
With regard to the accessing and transfer of data, efficiency can also be had via the thoughtful architecting of data structures. In general, computer systems have a number of ways to represent contiguous logical memory in discontinuous data structures. This is of particular importance when a producer and a consumer of data differ in the techniques employed in representing such data. For example, when such differences exist, a certain amount of time and effort must be expended in marshalling the requisite data due to the reformatting of the data thus necessitated. Such marshalling is often inefficient both in terms of the time required by such operations and the memory space the operations consume.
A data structure and method according to the present invention avoids the shortcomings historically encountered in transferring data between a producer of such data and a consumer of that data by employing a technique for abstracting the data""s description that provides an automatic and efficient way of converting from one data representation to another.
In one embodiment of the present invention, a data structure is disclosed. The data structure includes a data descriptor record. In turn, the data descriptor record includes a type field, a base address field, an offset field and a length field. The type field may be configured, for example, to indicate a data structure type. The data structure type may be configured to assume a values indicating one of a contiguous buffer, a scatter-gather list and a linked list structure, among other such data structures. The base address field may be configured, for example, to store a base address, with the base address being a starting address of a secondary data structure associated with the data descriptor record. The offset field may be configured, for example, to indicate a starting address of data within a secondary data structure pointed to by a base address stored in the base address field. The length field is configured to indicate a length of data stored in a secondary data structure pointed to by a base address stored in the base address field.
In one aspect of the embodiment, the data descriptor record further includes an in-line data field, a context field, and an in-line data buffer. The in-line data field may be configured, for example, to store information regarding the in-line data buffer. The context field may be configured, for example, to store information regarding an address space type in which the data descriptor record exists. The in-line data buffer may be configured, for example, to store data contiguously with the data descriptor record. The information regarding the in-line data buffer may include, for example, a length of the in-line data buffer. The length of the in-line data buffer may be made to be capable of assuming only set values or a variable value. The length of the in-line data buffer may be configured such that when the length assumes a non-zero value to indicate that the in-line data buffer is used.
In one embodiment of the present invention, a method of transferring data is disclosed. The method includes storing the data in a first data structure, copying the data from the first data structure to a second data structure, and reading the second data structure. In this arrangement, the first data structure is in a first data structure format and the second data structure is in a second data structure format. The copying includes re-formatting the data from the first data structure format to the second data structure format.
The foregoing is a summary; and thus contains, by necessity, simplifications, generalizations and omissions of detail; consequently, those skilled in the art will appreciate that the summary is illustrative only; and is not; intended to be in any way limiting; other aspects, inventive features, and advantages of the present invention, as defined solely by the claims, will become apparent in the non-limiting detailed description set forth below.